package cn.edu.sdjzu.xg.eagle.service.impl;

import cn.edu.sdjzu.xg.eagle.entities.Fees;
import cn.edu.sdjzu.xg.eagle.mapper.FeesMapper;
import cn.edu.sdjzu.xg.eagle.service.inface.FeesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;

@Service
public class FeesServiceImpl implements FeesService {

    @Autowired
    private FeesMapper feesMapper;

    @Override
    public String addFee(Fees fee) throws SQLException {
        if (feesMapper.addFee(fee)) {
            return "添加费用成功";
        }
        return "添加费用失败";
    }

    @Override
    public String deleteFee(int feeId) throws SQLException {
        if (feesMapper.deleteFee(feeId)) {
            return "删除费用成功";
        } else {
            return "删除费用失败";
        }
    }

    @Override
    public String updateFee(Fees fee) throws SQLException {
        if (feesMapper.updateFee(fee)) {
            return "更新费用成功";
        } else {
            return "更新费用失败";
        }
    }

    @Override
    public Fees findFeeById(int feeId) throws SQLException {
        return feesMapper.findFeeById(feeId);
    }

    @Override
    public List<Fees> findAllFees() throws SQLException {
        return feesMapper.findAllFees();
    }
}